export default {
    methods:{
        add(obj){
            this.quest_addgood(obj)
        },
        reduce(obj){
            if(this.getNum(obj)<=1){
               this.$dialog.confirm({
                title: '提示',
                message: '只剩一个了确定要删除吗？',
                }).then(() => {
                   this.quset_reduce_shopcartlist(obj)
                }).catch(() => {
                  // on cancel
                });

            }else{
                this.quset_reduce_shopcartlist(obj)
            }
        },
        getNum(obj){//计算数量
            let index = this.shopcartlist.findIndex((item)=>{
                 return item.id == obj.id 
             })
             if(index!=-1){
               return this.shopcartlist[index].count
             }else{
               return 0
             }

       }
    }
}